package chpt08;

import java.io.File;
import java.io.FilenameFilter;
public class DirList{
	public static void main(String[] args){
		File path = new File("C:\\tmp");
		String[] files = path.list(new FilenameFilter(){
			public boolean accept(File dir, String name){
				return name.endsWith(".txt");
			}
		});
		if (files==null) {
			System.out.println("该目录下没有txt文件！");
		}else {			
			for(String file :files)
				System.out.println(file);
		}		
	}
}		